﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ServiceModel;
using System.ServiceModel.Channels;
using K.Contract;
namespace K.ClientPublic
{
    /// <summary>
    /// 负责建立远程对象
    /// </summary>
    public static class RemotingPublic
    {
        public static T CreateChannel<T>(string EndPointName)
        {
            //WSHttpBinding binding = new WSHttpBinding();
            //BasicHttpBinding binding = new BasicHttpBinding();
            //binding.Security.Mode = SecurityMode.None;
            //NetTcpBinding binding = new NetTcpBinding();
            //EndpointAddress address = new EndpointAddress("http://10.86.3.52:8080/K.WASHost/WASServiceForException.svc");
            //ChannelFactory<IExceptionDispose> channelFactory = new ChannelFactory<IExceptionDispose>(binding,address);
            ChannelFactory<T> channelFactory = new ChannelFactory<T>(EndPointName);
            
            return channelFactory.CreateChannel();
        }
    }
}
